package com.wontube.smr.pub;

import org.apache.ibatis.session.SqlSession;

import com.wontube.core.dao.SqlSessionManager;


/**
 * @author yuechao
 *
 */
public final class DefaultDBHelper {
	private static final String datasource = "smr";
	
	private DefaultDBHelper() {
	}
	
	public static SqlSession getSqlSession(boolean autoCommit) {
		return SqlSessionManager.manager.get(datasource, autoCommit);
	}
	
	/**
	 * autocommit = false
	 * @return
	 */
	public static SqlSession getSqlSession() {
		return SqlSessionManager.manager.get(datasource, false);
	}
	
	/**
	 * 返回用于批处理的SqlSession
	 * @return
	 */
	public static SqlSession getBatchSqlSession() {
		return SqlSessionManager.manager.getBatch(datasource);
	}
}
